home *** CD-ROM | disk | FTP | other *** search
- Path: news.iadfw.net!usenet
- From: Mark Nelson <markn@airmail.net>
- Newsgroups: comp.lang.c++
- Subject: Re: Dynamically allocated interrupt handlers?
- Date: Wed, 20 Mar 1996 21:08:37 -0600
- Organization: customer of Internet America
- Message-ID: <3150C835.3433@airmail.net>
- References: <4iqbv5$mqd@lori.albany.net>
- NNTP-Posting-Host: dal17-30.ppp.iadfw.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
-
- Stephen Behnfeldt wrote:
- >
- > I am building a SerialPort class to model the serial ports on my PC.
- > Associated with each instance of this class are elements such as an
- > input character buffer and a hardware address - data members which
- > will be unique to each instance.
-
- > So it seems like each handler will have to be
- > distinct - one for each instance of the class.
-
- You can minimize this pretty easily. Instead of having N interrupt handlers,
- you just code N different entry points. The entry points looks something like
- this:
-
- _interrupt isr0()
- {
- handler(0);
- }
-
- _interrupt isr1()
- {
- handler(1);
- }
-
- ...
-
- Then, your handler routine simply uses the number as an index into a
- table of pointers. The table has pointers to C++ objects, which then
- means you are back in object oriented land, where you belong.
-
- I cover this in some detail in my book "Serial Communications: A C++
- Developer's Guide." For more information on the book, follow the
- links on my home page.
-
- Mark Nelson
- http://web2.airmail.net/markn
-